<%@ page import="java.sql.*" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="pojo.Major" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>显示所有专业信息</title>
</head>
<body>
<a href="addMajor.jsp">添加专业</a>
<%
    //获取session中所保存的专业信息
    ArrayList<Major> allMajors= (ArrayList<Major>) session.getAttribute("allMajors");
    //显示专业信息
    out.println("<table border='1'>");
    out.println("<tr><td>专业ID</td><td>专业名称</td><td>编辑</td></tr>");
    for (Major major:allMajors){
        out.println("<tr>");
        out.println("<td>"+major.getId()+"</td>");
        out.println("<td>"+major.getMajorName()+"</td>");
        out.println("<td>");
        out.println("<a href='findMajorByIdServlet?id="+major.getId()+"'>修改</a>");
        out.println("<a href='deleteMajorServlet?id="+major.getId()+"'>删除</a>");
        out.println("</td>");
        out.println("</tr>");
    }
    out.println("</table>");
%>
</body>
</html>
